<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 * author weixing
 * date 2015-12-08
 */
//post数据不为空，并且密码与设定的密码保持一致
if ($_POST['hook'] != '') {
    //$checkdata = json_decode($_POST['hook']);
    $checkdata = $_POST['hook'];
    if (($checkdata['password'] != '') && ($checdata['password'] == '123qwe654')) {
        $www_folder = "/data/webapp/com.tonglingdi.testgit/";
        //git仓库地址
        $git_repo = "https://git.oschina.net/topstarwei/com.tonglingdi.testgit.git";
        //执行指令
        echo shell_exec(" cd $www_folder && git pull ");
    }else{
        /*$myfile = fopen("/data/webapp/com.tonglingdi.testgit/wwwroot/newfile.txt", "w") or die("Unable to open file!");
        fwrite($myfile, $txt);
        fclose($myfile); */
    }
}
